package com.example.yunxiappbackend.utils;

import lombok.Data;

/**
 * 通用返回结果工具类
 */
@Data
public class Result<T> {
    private T data;
    private String msg;
    private Integer code;

    public static <T> Result<T> success(T obj){
        Result<T> result = new Result<>();
        result.data = obj;
        result.code = 1;
        result.msg = "成功";
        return result;
    }
    public static <T> Result<T> error(String msg){
        Result<T> result = new Result<>();
        result.msg = msg;
        result.code = 0;
        return result;
    }
}
